package com.cnap.multiclouldmgmt.service;

import com.cnap.multiclouldmgmt.model.vm.VmModel;

import java.util.List;

/**
 * @author dyq
 * 远程登陆之后做操作
 */
public interface CnapSshService {

    /**
     * 拷贝安装所需东西
     @Param vmModel
     */
    void copyMasterInstallPackage(VmModel vmModel) throws Exception;

    /**
     * 设置免密拷贝
     @Param vmModel
     */
    void setNoPassWdCopy(String userName,String tagetIp,String targetPassWd) throws Exception;

    /**
     * 设置免密拷贝
     @Param vmModel
     */
    void setNoPassWdCopy(String sourceIp,String sourcePassWd,String userName,String targetIp,String targetPassWd) throws Exception;

    /**
     * 解压缩安装包
     * @param masterModel
     */
    void tarXvfInstallPackage(VmModel masterModel) throws Exception;

    /**
     * 配置参数并且安装
     * @param masterModel
     * @param workerModels
     */
    void configInstallParamAndInstall(VmModel masterModel, List<VmModel> workerModels) throws Exception;

    /**
     * 获取k8stoken
     */
    String getK8sToken(VmModel masterModel) throws Exception;

    /**
     * 
     * @param masterModel
     * @param vmModel
     */
    void addK8sWorker(VmModel masterModel, VmModel vmModel) throws Exception;

    /**
     * 安装前置工具
     * @param masterModel
     * @throws Exception
     */
    void installTools(VmModel masterModel) throws Exception;

    /**
     * 设置免密登陆
     * @param masterUser
     * @param externalIp
     * @param passwd
     * @param targetUser
     * @param targetIp
     * @param targetPasswd
     * @throws Exception
     */
    void setNoPassWdCopy(String masterUser, String externalIp, String passwd, String targetUser, String targetIp, String targetPasswd) throws Exception;

    /**
     *
     * @param masterModel
     */
    void setTencentRootSsh(VmModel masterModel) throws Exception;

    /**
     * 安装前预先执行的命令
     * @param masterModel
     * @throws Exception
     */
    void preInstallCmds(VmModel masterModel) throws Exception;

    /**
     * 获取安装包是否正常
     * @param masterModel
     * @return
     * @throws Exception
     */
    boolean getPackageNormal(VmModel masterModel) throws Exception;

    /**
     * 删除hostMumo信息
     * @param masterModel
     * @param vmModel
     * @throws Exception
     */
    void delHostMumo(VmModel masterModel,VmModel vmModel) throws Exception;

    /**
     *
     * @param masterModel
     * @param vmModel
     */
    void delInnerIpNoPasswdSsh(VmModel masterModel, VmModel vmModel);

    /**
     *
     * @param masterModel
     * @param vmModel
     */
    void delExternalIpNoPasswdSsh(VmModel masterModel, VmModel vmModel);

    /**
     *
     * @param vmModel
     * @return
     */
    boolean checkVmNetConnectSuccess(VmModel vmModel);

    /**
     * 在扩容worker节点之后，
     * 在woker上安装prometheus相关的东西
     * @param masterModel
     */
    void addWorkerPrometheus(VmModel masterModel);

    /**
     * 删除节点上的镜像
     * @param vmModel
     * @param imageInfo
     */
    void delNodeImage(VmModel vmModel,String imageInfo);

    void stopErrorInject(VmModel vmModel, String runningId);

    /**
     * 运行故障注入
     * @param vmModel
     * @param runningId
     * @return
     */
    String runErrorInject(VmModel vmModel, String runningId);

    /**
     * 安装混淆工具
     * @param vmModel
     */
    void copyAndInstallInjectTools(VmModel masterModel,VmModel vmModel);
}
